﻿using System;
using System.Collections.Generic;
using SharpSqlAnalyzer.nodes;

namespace SharpSqlAnalyzer.stmt
{
	// Token: 0x02000086 RID: 134
	public class TAlterViewStatement : TCustomSqlStatement
	{
		// Token: 0x06000354 RID: 852 RVA: 0x002F9BF9 File Offset: 0x002F7DF9
		public TAlterViewStatement(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstalterview;
		}

		// Token: 0x17000055 RID: 85
		// (get) Token: 0x06000355 RID: 853 RVA: 0x002F9C0A File Offset: 0x002F7E0A
		// (set) Token: 0x06000356 RID: 854 RVA: 0x002F9C12 File Offset: 0x002F7E12
		public virtual TObjectName ViewName
		{
			get
			{
				return this.viewName;
			}
			set
			{
				this.viewName = value;
			}
		}

		// Token: 0x17000056 RID: 86
		// (get) Token: 0x06000357 RID: 855 RVA: 0x002F9C1B File Offset: 0x002F7E1B
		// (set) Token: 0x06000358 RID: 856 RVA: 0x002F9C23 File Offset: 0x002F7E23
		public virtual EAlterViewOption AlterViewOption
		{
			get
			{
				return this.alterViewOption;
			}
			set
			{
				this.alterViewOption = value;
			}
		}

		// Token: 0x17000057 RID: 87
		// (get) Token: 0x06000359 RID: 857 RVA: 0x002F9C2C File Offset: 0x002F7E2C
		// (set) Token: 0x0600035A RID: 858 RVA: 0x002F9C34 File Offset: 0x002F7E34
		public virtual TObjectName NewViewName
		{
			get
			{
				return this.newViewName;
			}
			set
			{
				this.newViewName = value;
			}
		}

		// Token: 0x17000058 RID: 88
		// (get) Token: 0x0600035B RID: 859 RVA: 0x002F9C3D File Offset: 0x002F7E3D
		// (set) Token: 0x0600035C RID: 860 RVA: 0x002F9C45 File Offset: 0x002F7E45
		public virtual List<TPartitionExtensionClause> PartitionSpecs
		{
			get
			{
				return this.partitionSpecs;
			}
			set
			{
				this.partitionSpecs = value;
			}
		}

		// Token: 0x17000059 RID: 89
		// (get) Token: 0x0600035D RID: 861 RVA: 0x002F9C4E File Offset: 0x002F7E4E
		// (set) Token: 0x0600035E RID: 862 RVA: 0x002F9C56 File Offset: 0x002F7E56
		public virtual TSelectSqlStatement SelectSqlStatement
		{
			get
			{
				return this.selectSqlStatement;
			}
			set
			{
				this.selectSqlStatement = value;
			}
		}

		// Token: 0x0600035F RID: 863 RVA: 0x002F9C60 File Offset: 0x002F7E60
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			base.doParseStatement(psql);
			TAlterViewSqlNode talterViewSqlNode = (TAlterViewSqlNode)this.rootNode;
			this.alterViewOption = talterViewSqlNode.AlterViewOption;
			this.viewName = talterViewSqlNode.ViewName;
			base.DatabaseObjects.Add(this.viewName);
			this.newViewName = talterViewSqlNode.NewViewName;
			this.partitionSpecs = talterViewSqlNode.PartitionSpecs;
			if (talterViewSqlNode.SelectSqlNode != null)
			{
				this.selectSqlStatement = new TSelectSqlStatement(EDbVendor.dbvhive);
				this.selectSqlStatement.rootNode = talterViewSqlNode.SelectSqlNode;
				this.selectSqlStatement.startToken = talterViewSqlNode.SelectSqlNode.startToken;
				this.selectSqlStatement.endToken = talterViewSqlNode.SelectSqlNode.endToken;
				this.selectSqlStatement.doParseStatement(this);
			}
			return 0;
		}

		// Token: 0x06000360 RID: 864 RVA: 0x002F9D2B File Offset: 0x002F7F2B
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x06000361 RID: 865 RVA: 0x002F9D3B File Offset: 0x002F7F3B
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			if (this.selectSqlStatement != null)
			{
				this.selectSqlStatement.accept(v);
			}
			v.postVisit(this);
		}

		// Token: 0x040010A6 RID: 4262
		private TObjectName viewName;

		// Token: 0x040010A7 RID: 4263
		private EAlterViewOption alterViewOption;

		// Token: 0x040010A8 RID: 4264
		private TObjectName newViewName;

		// Token: 0x040010A9 RID: 4265
		private List<TPartitionExtensionClause> partitionSpecs;

		// Token: 0x040010AA RID: 4266
		private TSelectSqlStatement selectSqlStatement;
	}
}
